package b_thread;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package b_thread
 * @date 2024/4/7 下午5:13
 */
public class test04 {
    public static void main(String[] args) {
        test t1 = new test();
        test t2 = new test();
        t1.setName("线程1");
        t2.setName("线程2");
        t2.setDaemon(true);//设置守护线程
        t1.start();
        t2.start();
    }

}

class test extends Thread {
    @Override
    public void run() {
        for (int i = 0; i < 100; i++) {
            System.out.println(currentThread().getName() + "执行了：" + i);

        }
    }
}
